import request from '@/utils/request'

export function getSupportRequests() {
  return request({
    url: '/api/support/requests',
    method: 'get',
    params: { includeReply: true } // 添加参数获取回复信息
  })
}

export function updateSupportRequest(id, reply) {
    return request({
      url: `/api/support/requests/${id}/reply`,
      method: 'put',
      headers: {
        'Content-Type': 'text/plain' // 明确指定内容类型
      },
      data: reply  // 直接发送字符串内容
    })
}

export function createSupportRequest(data) {
  return request({
    url: '/api/support/requests',
    method: 'post',
    data
  })
}

// 新增回复状态常量
export const ReplyStatus = {
  PENDING: 'pending',
  REPLIED: 'replied'
}